import org.junit.Test;
import org.junit.Before;
import org.junit.After;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.core.IsNot.not;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Alert;
import org.openqa.selenium.Keys;
import java.util.*;
import java.net.MalformedURLException;
import java.net.URL;
public class PSYScheduleAdminTest {
  private WebDriver driver;
  private Map<String, Object> vars;
  JavascriptExecutor js;
  @Before
  public void setUp() {
    driver = new ChromeDriver();
    js = (JavascriptExecutor) driver;
    vars = new HashMap<String, Object>();
  }
  @After
  public void tearDown() {
    driver.quit();
  }
  public void PSYLoginAdminTrue01() {
    driver.get("https://sei-test.021hqit.com/group-5/group-5/");
    driver.findElement(By.cssSelector(".el-form-item:nth-child(1) .el-input__inner")).sendKeys("ecnu_admin");
    driver.findElement(By.cssSelector(".el-form-item:nth-child(2) .el-input__inner")).click();
    driver.findElement(By.cssSelector(".el-form-item:nth-child(2) .el-input__inner")).sendKeys("pl,okm123");
    driver.findElement(By.cssSelector(".el-button")).click();
    vars.put("message", driver.findElement(By.cssSelector(".el-message")).getText());
    assertEquals(vars.get("message").toString(), "登录成功");
  }
  @Test
  public void pSYScheduleAdminAddDeleteCounselor() {
    PSYLoginAdminTrue01();
    driver.findElement(By.cssSelector(".el-menu-item:nth-child(3)")).click();
    driver.findElement(By.cssSelector(".el-row:nth-child(3)")).click();
    driver.findElement(By.cssSelector(".el-select__input")).click();
    driver.findElement(By.xpath("//span[contains(.,\'Kenn（myCounseler）\')]")).click();
    driver.findElement(By.cssSelector(".scheduleAddModal")).click();
    driver.findElement(By.cssSelector(".el-button--default:nth-child(2)")).click();
    driver.findElement(By.xpath("//div[contains(text(), \'Kenn\')]/following-sibling::div[contains(@class, \'el-col el-col-6\')]")).click();
    driver.findElement(By.cssSelector(".el-button--small:nth-child(2)")).click();
    driver.findElement(By.cssSelector(".el-menu-item:nth-child(3) > span")).click();
  }
  @Test
  public void pSYScheduleAdminAddDeleteSupervisor() {
    PSYLoginAdminTrue01();
    driver.findElement(By.cssSelector(".el-menu-item:nth-child(3)")).click();
    driver.findElement(By.cssSelector(".leftActive > .el-col:nth-child(2)")).click();
    driver.findElement(By.cssSelector(".el-row:nth-child(3)")).click();
    driver.findElement(By.cssSelector(".el-select__input")).click();
    driver.findElement(By.xpath("//span[contains(.,\'wuwenxuan（wuwenxuan）\')]")).click();
    driver.findElement(By.cssSelector(".scheduleAddModal")).click();
    driver.findElement(By.cssSelector(".el-button--default:nth-child(2)")).click();
    driver.findElement(By.xpath("//div[contains(text(), \'wuwenxuan\')]/following-sibling::div[contains(@class, \'el-col el-col-6\')]")).click();
    driver.findElement(By.cssSelector(".el-button--small:nth-child(2)")).click();
    driver.findElement(By.cssSelector(".el-menu-item:nth-child(3) > span")).click();
  }
  @Test
  public void pSYScheduleAdminPage() {
    PSYLoginAdminTrue01();
    driver.findElement(By.cssSelector(".el-menu-item:nth-child(3)")).click();
    driver.findElement(By.cssSelector(".dateItem:nth-child(25) > .watcher:nth-child(2)")).click();
    driver.findElement(By.cssSelector(".dateItem:nth-child(24)")).click();
    driver.findElement(By.cssSelector(".dateItem:nth-child(23)")).click();
    driver.findElement(By.cssSelector(".dateItem:nth-child(22)")).click();
    driver.findElement(By.cssSelector(".dateItem:nth-child(21)")).click();
    driver.findElement(By.cssSelector(".dateItem:nth-child(35)")).click();
    driver.findElement(By.cssSelector(".dateItem:nth-child(34)")).click();
    driver.findElement(By.cssSelector(".dateItem:nth-child(33)")).click();
    driver.findElement(By.cssSelector(".dateItem:nth-child(32)")).click();
    driver.findElement(By.cssSelector(".dateItem:nth-child(31)")).click();
    driver.findElement(By.cssSelector(".dateItem:nth-child(30)")).click();
    driver.findElement(By.cssSelector(".dateItem:nth-child(29)")).click();
    driver.findElement(By.cssSelector(".el-menu-item:nth-child(3)")).click();
  }
  @Test
  public void pSYScheduleAdminAddDeleteCounselors() {
    PSYLoginAdminTrue01();
    driver.findElement(By.cssSelector(".el-menu-item:nth-child(3)")).click();
    driver.findElement(By.cssSelector(".el-row:nth-child(3)")).click();
    driver.findElement(By.cssSelector(".el-select__input")).click();
    driver.findElement(By.xpath("//span[contains(.,\'Kenn（myCounseler）\')]")).click();
    driver.findElement(By.xpath("//span[contains(.,\'zok（zok）\')]")).click();
    driver.findElement(By.xpath("//span[contains(.,\'wcy（wcy_ios）\')]")).click();
    driver.findElement(By.cssSelector(".scheduleAddModal")).click();
    driver.findElement(By.cssSelector(".el-button--default:nth-child(2)")).click();
    driver.findElement(By.xpath("//div[contains(text(), \'Kenn\')]/following-sibling::div[contains(@class, \'el-col el-col-6\')]")).click();
    driver.findElement(By.cssSelector(".el-button--small:nth-child(2)")).click();
    driver.findElement(By.xpath("//div[contains(text(), \'zok（zok）\')]/following-sibling::div[contains(@class, \'el-col el-col-6\')]")).click();
    driver.findElement(By.cssSelector(".el-button--small:nth-child(2)")).click();
    driver.findElement(By.xpath("//div[contains(text(), \'wcy（wcy_ios）\')]/following-sibling::div[contains(@class, \'el-col el-col-6\')]")).click();
    driver.findElement(By.cssSelector(".el-button--small:nth-child(2)")).click();
    driver.findElement(By.cssSelector(".el-menu-item:nth-child(3) > span")).click();
  }
  @Test
  public void pSYScheduleAdminAddDeleteSupervisors() {
    PSYLoginAdminTrue01();
    driver.findElement(By.cssSelector(".el-menu-item:nth-child(3)")).click();
    driver.findElement(By.cssSelector(".leftActive > .el-col:nth-child(2)")).click();
    driver.findElement(By.cssSelector(".el-row:nth-child(3)")).click();
    driver.findElement(By.cssSelector(".el-select__input")).click();
    driver.findElement(By.xpath("//span[contains(.,\'wuwenxuan（wuwenxuan）\')]")).click();
    driver.findElement(By.xpath("//span[contains(.,\'wuwenxuan（吴文轩）\')]")).click();
    driver.findElement(By.xpath("//span[contains(.,\'gzy（yyj1205）\')]")).click();
    driver.findElement(By.cssSelector(".scheduleAddModal")).click();
    driver.findElement(By.cssSelector(".el-button--default:nth-child(2)")).click();
    driver.findElement(By.xpath("//div[contains(text(), \'wuwenxuan（wuwenxuan）\')]/following-sibling::div[contains(@class, \'el-col el-col-6\')]")).click();
    driver.findElement(By.cssSelector(".el-button--small:nth-child(2)")).click();
    driver.findElement(By.xpath("//div[contains(text(), \'wuwenxuan（吴文轩）\')]/following-sibling::div[contains(@class, \'el-col el-col-6\')]")).click();
    driver.findElement(By.cssSelector(".el-button--small:nth-child(2)")).click();
    driver.findElement(By.xpath("//div[contains(text(), \'gzy（yyj1205）\')]/following-sibling::div[contains(@class, \'el-col el-col-6\')]")).click();
    driver.findElement(By.cssSelector(".el-button--small:nth-child(2)")).click();
    driver.findElement(By.cssSelector(".el-menu-item:nth-child(3) > span")).click();
  }
}
